package com.foreknow.demo24;

/**
 * 动态可变的参数 Object[]
 * Object...values
 */
public class DynVarArgs {
  public void method1(int a,int b) {
    System.out.println(a+b);
  }

  public void method2(String sql,Object...values) {
    System.out.println(sql);
  }

  public void method3(int a,Object...values){
    for(int i = 0;i<values.length;i++){
      System.out.println(values[i]);
    }
  }

  public static void main(String[] args) {
    DynVarArgs dynVarArgs = new DynVarArgs();
    dynVarArgs.method1(1,2);

    dynVarArgs.method2("select * from emp where empno=? and ename=?","7369","smith");

    dynVarArgs.method3(1,2,3,4,5,6);
  }
}
